package com.azxc.rapid.plus.user.dto;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import java.io.Serializable;
import java.util.List;
import lombok.Data;

/**
 * @author lhy
 * @version 1.0.0 2022/6/23 15:55
 */
@Data
public class PageFeign<T> implements Serializable {

  public PageFeign() {

  }

  public PageFeign(Page<T> page) {
    this.records = page.getRecords();
    this.total = page.getTotal();
    this.size = page.getSize();
    this.current = page.getCurrent();
    this.pages = page.getPages();
  }

  public PageFeign(IPage<T> page) {
    this.records = page.getRecords();
    this.total = page.getTotal();
    this.size = page.getSize();
    this.current = page.getCurrent();
    this.pages = page.getPages();
  }

  private List<T> records;
  /**
   * 总数
   */
  private long total = 0;
  /**
   * 每页显示条数，默认 10
   */
  private long size = 10;
  /**
   * 当前页
   */
  private long current = 1;
  /**
   * 总页数
   */
  private long pages = 10;
}
